home *** CD-ROM | disk | FTP | other *** search
- package views
- {
- import events.NavigationEvent;
- import flash.accessibility.*;
- import flash.debugger.*;
- import flash.display.*;
- import flash.errors.*;
- import flash.events.*;
- import flash.external.*;
- import flash.filters.*;
- import flash.geom.*;
- import flash.media.*;
- import flash.net.*;
- import flash.printing.*;
- import flash.profiler.*;
- import flash.system.*;
- import flash.text.*;
- import flash.ui.*;
- import flash.utils.*;
- import flash.xml.*;
- import model.PresentationModel;
- import mx.binding.*;
- import mx.binding.utils.ChangeWatcher;
- import mx.collections.ArrayCollection;
- import mx.containers.Canvas;
- import mx.containers.VBox;
- import mx.controls.Image;
- import mx.core.Repeater;
- import mx.core.UIComponentDescriptor;
- import mx.core.mx_internal;
- import mx.events.FlexEvent;
- import mx.events.PropertyChangeEvent;
- import mx.styles.*;
-
- public class SpreadsTab extends Canvas
- {
- private static var _watcherSetupUtil:IWatcherSetupUtil;
-
- private var _bindings:Array;
-
- public var _bindingsByDestination:Object;
-
- [Bindable]
- private var _907050744spreadsRepeater:Repeater;
-
- [Bindable]
- private var _1493698499_VBox1:VBox;
-
- [Bindable]
- private var _874346147thumbs:ArrayCollection;
-
- public var _bindingsBeginWithWord:Object;
-
- public var myWatcher:ChangeWatcher;
-
- [Bindable]
- private var _1857328081presentationModel:PresentationModel;
-
- [Bindable]
- private var _2145370147spreadThumb:Array;
-
- private var currentIssue:int = -1;
-
- private var _embed_mxml____embedded_assets_spreads_tab_bg_png_224686987:Class;
-
- private var _watchers:Array;
-
- private var _documentDescriptor_:UIComponentDescriptor;
-
- public function SpreadsTab()
- {
- _documentDescriptor_ = new UIComponentDescriptor({
- "type":Canvas,
- "propertiesFactory":function():Object
- {
- return {
- "width":206,
- "height":926,
- "childDescriptors":[new UIComponentDescriptor({
- "type":Image,
- "propertiesFactory":function():Object
- {
- return {
- "source":_embed_mxml____embedded_assets_spreads_tab_bg_png_224686987,
- "width":206,
- "height":926
- };
- }
- }),new UIComponentDescriptor({
- "type":VBox,
- "id":"_VBox1",
- "stylesFactory":function():void
- {
- this.verticalGap = 10;
- this.paddingTop = 30;
- this.paddingBottom = 30;
- this.paddingLeft = 10;
- this.paddingRight = 20;
- this.horizontalAlign = "center";
- this.backgroundColor = 14277081;
- },
- "propertiesFactory":function():Object
- {
- return {
- "verticalLineScrollSize":10,
- "x":6,
- "y":15,
- "width":188,
- "height":885,
- "horizontalScrollPolicy":"off",
- "childDescriptors":[new UIComponentDescriptor({
- "type":Repeater,
- "id":"spreadsRepeater",
- "propertiesFactory":function():Object
- {
- return {"childDescriptors":[new UIComponentDescriptor({
- "type":SpreadThumb,
- "id":"spreadThumb",
- "events":{
- "click":"__spreadThumb_click",
- "rollOver":"__spreadThumb_rollOver",
- "rollOut":"__spreadThumb_rollOut"
- },
- "propertiesFactory":function():Object
- {
- return {
- "buttonMode":true,
- "width":140
- };
- }
- })]};
- }
- })]
- };
- }
- })]
- };
- }
- });
- currentIssue = -1;
- _embed_mxml____embedded_assets_spreads_tab_bg_png_224686987 = SpreadsTab__embed_mxml____embedded_assets_spreads_tab_bg_png_224686987;
- super();
- mx_internal::_document = this;
- this.width = 206;
- this.height = 926;
- this.addEventListener("creationComplete",___Canvas1_creationComplete);
- }
-
- public static function set watcherSetupUtil(param1:IWatcherSetupUtil) : void
- {
- SpreadsTab._watcherSetupUtil = param1;
- }
-
- private function pgNumber(param1:int) : String
- {
- var _loc2_:String = null;
- _loc2_ = param1.toString();
- if(10 > param1)
- {
- _loc2_ = "0" + _loc2_;
- }
- if(100 > param1)
- {
- _loc2_ = "0" + _loc2_;
- }
- return _loc2_;
- }
-
- private function _SpreadsTab_bindingExprs() : void
- {
- var _loc1_:* = undefined;
- _loc1_ = thumbs;
- _loc1_ = getHighlightStyle(presentationModel.currentPage,spreadsRepeater.currentIndex);
- _loc1_ = formatText(spreadsRepeater.currentIndex);
- _loc1_ = spreadsRepeater.currentItem;
- }
-
- [Bindable(event="propertyChange")]
- public function get spreadThumb() : Array
- {
- return this._2145370147spreadThumb;
- }
-
- public function set spreadThumb(param1:Array) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._2145370147spreadThumb;
- if(_loc2_ !== param1)
- {
- this._2145370147spreadThumb = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"spreadThumb",_loc2_,param1));
- }
- }
-
- [Bindable(event="propertyChange")]
- public function get _VBox1() : VBox
- {
- return this._1493698499_VBox1;
- }
-
- public function set presentationModel(param1:PresentationModel) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._1857328081presentationModel;
- if(_loc2_ !== param1)
- {
- this._1857328081presentationModel = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"presentationModel",_loc2_,param1));
- }
- }
-
- public function set _VBox1(param1:VBox) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._1493698499_VBox1;
- if(_loc2_ !== param1)
- {
- this._1493698499_VBox1 = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_VBox1",_loc2_,param1));
- }
- }
-
- [Bindable(event="propertyChange")]
- public function get presentationModel() : PresentationModel
- {
- return this._1857328081presentationModel;
- }
-
- private function rollOutHandler(param1:Event) : void
- {
- if(param1.target.repeaterIndex == presentationModel.currentPage)
- {
- param1.target.oldStyle = "spreadThumbHighlight";
- }
- param1.target.style = param1.target.oldStyle;
- }
-
- private function clickHandler(param1:Event) : void
- {
- var _loc2_:int = 0;
- _loc2_ = int(param1.currentTarget.repeaterIndex);
- dispatchEvent(new NavigationEvent(NavigationEvent.SELECT_PAGE,_loc2_,true));
- }
-
- [Bindable(event="propertyChange")]
- public function get spreadsRepeater() : Repeater
- {
- return this._907050744spreadsRepeater;
- }
-
- private function init() : void
- {
- myWatcher = ChangeWatcher.watch(this,["presentationModel","currentIssue"],presentationModelListener);
- thumbs = new ArrayCollection(new Array());
- }
-
- [Bindable(event="propertyChange")]
- private function get thumbs() : ArrayCollection
- {
- return this._874346147thumbs;
- }
-
- public function __spreadThumb_rollOut(param1:MouseEvent) : void
- {
- rollOutHandler(param1);
- }
-
- private function formatText(param1:int) : String
- {
- var _loc2_:String = null;
- var _loc3_:int = 0;
- if(-1 == param1 || -1 == presentationModel.numPages)
- {
- return "";
- }
- _loc2_ = "" + param1.toString();
- if(0 == param1)
- {
- _loc2_ = "" + 1;
- }
- else if(param1 == presentationModel.numPages - 1 && false == presentationModel.twoPageBack)
- {
- _loc2_ = "" + param1 * 2;
- }
- else
- {
- _loc3_ = param1 * 2;
- _loc2_ = "" + _loc3_ + " & " + ++_loc3_;
- }
- return _loc2_;
- }
-
- public function presentationModelListener(param1:PropertyChangeEvent) : void
- {
- var _loc2_:String = null;
- var _loc3_:String = null;
- var _loc4_:int = 0;
- var _loc5_:Array = null;
- var _loc6_:int = 0;
- trace("presentationModel has changed curr " + currentIssue + ", p.curr " + presentationModel.currentIssue + ", pages " + presentationModel.numPages + ", issues " + presentationModel.issues);
- _loc2_ = presentationModel.yearString;
- if(null == presentationModel.issues || -1 == presentationModel.numPages)
- {
- return;
- }
- if(-1 != currentIssue && currentIssue == presentationModel.currentIssue)
- {
- return;
- }
- currentIssue = presentationModel.currentIssue;
- _loc3_ = presentationModel.filePrefix;
- _loc4_ = presentationModel.numPages;
- _loc5_ = new Array(_loc4_);
- trace("presentationModel changed: now I am here " + _loc3_ + ", " + _loc4_);
- _loc6_ = 0;
- while(_loc6_ < _loc4_)
- {
- _loc5_[_loc6_] = _loc2_ + "/" + _loc3_ + "-" + pgNumber(_loc6_) + ".jpg";
- _loc6_++;
- }
- thumbs = new ArrayCollection(_loc5_);
- }
-
- public function set spreadsRepeater(param1:Repeater) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._907050744spreadsRepeater;
- if(_loc2_ !== param1)
- {
- this._907050744spreadsRepeater = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"spreadsRepeater",_loc2_,param1));
- }
- }
-
- private function getHighlightStyle(param1:int, param2:int) : String
- {
- trace("getHighlightStyle " + param1 + " current " + param2);
- return param2 == param1 ? "spreadThumbHighlight" : "spreadThumbNormal";
- }
-
- public function ___Canvas1_creationComplete(param1:FlexEvent) : void
- {
- init();
- }
-
- public function __spreadThumb_click(param1:MouseEvent) : void
- {
- clickHandler(param1);
- }
-
- private function set thumbs(param1:ArrayCollection) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._874346147thumbs;
- if(_loc2_ !== param1)
- {
- this._874346147thumbs = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"thumbs",_loc2_,param1));
- }
- }
-
- private function rollOverHandler(param1:Event) : void
- {
- param1.target.oldStyle = param1.target.style;
- param1.target.style = "spreadThumbHighlight";
- }
-
- public function __spreadThumb_rollOver(param1:MouseEvent) : void
- {
- rollOverHandler(param1);
- }
-
- override public function initialize() : void
- {
- var target:SpreadsTab = null;
- var watcherSetupUtilClass:Object = null;
- mx_internal::setDocumentDescriptor(_documentDescriptor_);
- _SpreadsTab_bindingsSetup();
- target = this;
- if(_watcherSetupUtil == null)
- {
- watcherSetupUtilClass = getDefinitionByName("_views_SpreadsTabWatcherSetupUtil");
- watcherSetupUtilClass["init"](null);
- }
- _watcherSetupUtil.setup(this,function(param1:String):*
- {
- return target[param1];
- },_bindings,_watchers);
- super.initialize();
- }
-
- private function _SpreadsTab_bindingsSetup() : void
- {
- var binding:Binding = null;
- if(!_bindings)
- {
- _bindings = [];
- }
- if(!_watchers)
- {
- _watchers = [];
- }
- binding = new Binding(this,function():Object
- {
- return thumbs;
- },function(param1:Object):void
- {
- spreadsRepeater.dataProvider = param1;
- },"spreadsRepeater.dataProvider");
- _bindings[0] = binding;
- binding = new RepeatableBinding(this,function(param1:Array, param2:Array):String
- {
- var _loc3_:* = undefined;
- var _loc4_:* = undefined;
- _loc3_ = getHighlightStyle(presentationModel.currentPage,param2[0]);
- return _loc3_ == undefined ? null : String(_loc3_);
- },function(param1:String, param2:Array):void
- {
- spreadThumb[param2[0]].style = param1;
- },"spreadThumb.style");
- _bindings[1] = binding;
- binding = new RepeatableBinding(this,function(param1:Array, param2:Array):String
- {
- var _loc3_:* = undefined;
- var _loc4_:* = undefined;
- _loc3_ = formatText(param2[0]);
- return _loc3_ == undefined ? null : String(_loc3_);
- },function(param1:String, param2:Array):void
- {
- spreadThumb[param2[0]].page = param1;
- },"spreadThumb.page");
- _bindings[2] = binding;
- binding = new RepeatableBinding(this,function(param1:Array, param2:Array):String
- {
- var _loc3_:* = undefined;
- var _loc4_:* = undefined;
- _loc3_ = spreadsRepeater.mx_internal::getItemAt(param2[0]);
- return _loc3_ == undefined ? null : String(_loc3_);
- },function(param1:String, param2:Array):void
- {
- spreadThumb[param2[0]].imageURL = param1;
- },"spreadThumb.imageURL");
- _bindings[3] = binding;
- }
- }
- }
-
-